﻿@using ForzaGT3.Data
@model IEnumerable<Series>
@{
    ViewBag.Title = "Index";
    string lang = string.Empty;
    if (!string.IsNullOrEmpty(Request.QueryString["lang"]))
    {
        lang = Request.QueryString["lang"];
    }
}
@if (Model != null)
{
    foreach (Series data in Model)
    {
        <div class="redbg header shadow">@data.Title</div>
        <div class="seriesimg">
            @if (!string.IsNullOrEmpty(lang))
            {
                <a href="@Url.Action("Details","Series", new { Id = data.SeriesId, lang = lang })">
                    <div class="overlay">
                        <div class="country">
                            <img src="@Url.Content("~" + data.Circuit.Country.FlagUrl)"  align="left" style="padding-top: 10px;" alt="@data.Circuit.Country.Name" />
                            @data.Circuit.Country.Name
                        </div>
                        <div class="date">
                            @data.StartDate.ToString("dd") - @data.FinishDate.ToString("dd MMMM yyyy")</div>
                    </div>
                    <img src="@Url.Content("~" + data.BannerUrl)" alt="@data.Title" />
                </a>
            }
            else
            {
                <a href="@Url.Action(MVC.Series.Details(data.SeriesId))">
                    <div class="overlay">
                        <div class="country">
                            <img src="@Url.Content("~" + data.Circuit.Country.FlagUrl)"  align="left" style="padding-top: 10px;" alt="@data.Circuit.Country.Name" />
                            @data.Circuit.Country.Name
                        </div>
                        <div class="date">
                            @data.StartDate.ToString("dd") - @data.FinishDate.ToString("dd MMMM yyyy")</div>
                    </div>
                    <img src="@Url.Content("~" + data.BannerUrl)" alt="@data.Title" />
                </a>
            }
            
        </div>
    
        <br />
        <br />
    }
}